From 8be3789ecdca42a9b2e3ac8b4f207d3cec5ea85f Mon Sep 17 00:00:00 2001 From: robertlipe Date: Mon, 14 Nov 2011 18:08:53 +0000 Subject: [PATCH] Refoermat mmo.c. --- gpsbabel/mmo.c | 65 ++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/gpsbabel/mmo.c b/gpsbabel/mmo.c index c05832af1..4b4671b2d 100644 --- a/gpsbabel/mmo.c +++ b/gpsbabel/mmo.c @@ -172,7 +172,7 @@ dbgprintf(const char* sobj, const char* fmt, ...) static char* mmo_readstr(void) { - char *res; + char* res; int len; len = (unsigned)gbfgetc(fin); @@ -180,45 +180,38 @@ mmo_readstr(void) // Next two bytes are either the length (strings longer than 254 chars) // or FE then FF (which is -2) meaning a UTF-16 string len = gbfgetint16(fin); - if (len == -2) - { + if (len == -2) { // read the new length (single byte) // length is number of "characters" not number of bytes len = (unsigned)gbfgetc(fin); - if (len > 0) - { - int ii, jj, ch, resbytes=0; - res = xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion - for (ii=0; ii 0) { + int ii, jj, ch, resbytes=0; + res = xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion + for (ii=0; ii= 0x16) { gbuint16 u16; - char *text; + char* text; // XXX ARB was u8 = gbfgetc(fin); but actually a string text = mmo_readstr(); -- 2.30.2